![]() |
Kinetis SDK Demo Applications User Guide
1.0.0-beta
Freescale Semiconductor, Inc.
|
#include <string.h>#include <stdio.h>#include "board.h"#include "pin_mux.h"#include "gpio_pins.h"#include "fsl_gpio_driver.h"#include "spi_flash/spi_flash.h"#include "fsl_device_registers.h"#include "fsl_misc_utilities.h"#include "cmd_handle.h"#include "char_handle.h"Macros | |
| #define | SF_DEFAULT_SPEED |
| #define | SF_DEFAULT_MODE |
| #define | SF_DEFAULT_CS |
| #define | SF_DEFAULT_BUS |
Functions | |
| int32_t | spi_cs_activate (spi_slave_dev *spi) |
| int32_t | spi_cs_deactivate (spi_slave_dev *spi) |
| static int32_t | do_spi_flash_probe (int32_t argc, char *argv[]) |
| static const char * | spi_flash_update_block (spi_flash *flash, uint32_t offset, size_t len, const int8_t *buf, int8_t *cmp_buf, size_t *skipped) |
| Write a block of data to SPI flash, first checking if it is different from what is already there. More... | |
| static int32_t | spi_flash_update (spi_flash *flash, uint32_t offset, size_t len, const int8_t *buf) |
| static int32_t | do_spi_flash_read_write (int32_t argc, char *argv[]) |
| static int32_t | sf_parse_len_arg (char *arg, uint32_t *len) |
| This function computes the length argument for the erase command. More... | |
| static int32_t | do_spi_flash_erase (int32_t argc, char *argv[]) |
| static int32_t | do_spi_flash_print_usage (int32_t argc, char *argv[]) |
| void | main (void) |
Variables | |
| static spi_flash * | flash |
| cmd_tbl_t | sf_cmd_tbl [SPI_FLASH_FUNC_NUM] |
| #define SF_DEFAULT_BUS |
| #define SF_DEFAULT_CS |
| #define SF_DEFAULT_MODE |
| #define SF_DEFAULT_SPEED |
|
static |
|
static |
|
static |
|
static |
| void main | ( | void | ) |
|
static |
The length on which the command is to operate can be given in two forms:
| [in] | arg | length specification (i.e. both command arguments) |
| [out] | len | computed length for operation |
| int32_t spi_cs_activate | ( | spi_slave_dev * | spi | ) |
| int32_t spi_cs_deactivate | ( | spi_slave_dev * | spi | ) |
|
static |
Update an area of SPI flash by erasing and writing any blocks which need to change. Existing blocks with the correct data are left unchanged.
| [in] | flash | flash context pointer |
| [in] | offset | flash offset to write |
| [in] | len | number of bytes to write |
| [in] | buf | buffer to write from |
|
static |
If the data being written is the same, then *skipped is incremented by len.
| [in] | flash | flash context pointer |
| [in] | offset | flash offset to write |
| [in] | len | number of bytes to write |
| [in] | buf | buffer to write from |
| [in] | cmp_buf | read buffer to use to compare data |
| [in] | skipped | Count of skipped data (incremented by this function) |
|
static |
| cmd_tbl_t sf_cmd_tbl[SPI_FLASH_FUNC_NUM] |